import React from 'react'
import '../assets/css/botplay.css'

class Controlplay extends React.Component {
    constructor() {
        super()
        this.state = {
            src: require('../assets/iconfont/bofang.png'),
            src1: require('../assets/iconfont/pause.png'),
        }
    }

    handleChange() {
        //改变播放状态
        this.props.playOrPause(!this.props.audio)
        if(this.props.musicurl===''){
            this.props.getMusicURLApi(this.props.playmusiclist[0].id)
        }
    }
    handleChangeShowPlay() {
        this.props.changeShowplaylist(!this.props.showplaylist)
    }
    render() {
        return (
            <div className='control-play'>
                {/* 播放/暂停 */}
                <span onClick={this.handleChange.bind(this)} className='play'>
                    <img src={this.props.audio ? this.state.src1 : this.state.src} />
                </span>
                {/* 菜单 */}
                <span className='play1' onClick={this.handleChangeShowPlay.bind(this)}>
                    <img src={require('../assets/iconfont/caidan.png')} />
                </span>
            </div>
        )
    }
}

export default Controlplay;